<extend name="Public:base"/>

<block name="main">
<div id="yzh-content" class="col-xs-12">
    <div class="main-title">
        <h2>栏目设置</h2>
    </div>

    <div class="row">
        <div class="col-md-12">
            <table class="table table-hover table-bordered">
                <thead>
                <tr>
                    <th width="60">ID</th>
                    <th>pc栏目名称</th>
                    <!--<th>手机栏目名称</th>-->
                    <th>启用</th>
                    <!--<th class="w-100">操作管理</th>-->
                </tr>
                </thead>
                <tbody>
                <volist name="list" id="vo" key="k">
                    <tr>
                        <td>{$vo['id']}</td>
                        <td>{$vo['catname']}</td>
                        <!--<td>-->
                            <!--<input type="text" onchange="updateCatname(this, {$vo['id']})" value="{$vo['wap_catname']}">-->
                        <!--</td>-->
                        <td>
                            <eq name="vo.is_wap_menu" value="1">
                                <a href="javascript:updateStatus(0,{$vo['id']});"><i class="fa fa-check text-success"></i></a>
                                <else/>
                                <a href="javascript:updateStatus(1,{$vo['id']});"><i class="fa fa-ban text-danger"></i></a>
                            </eq>
                        </td>
                        <!--<td>-->
                            <!--<a class="btn btn-xs btn-primary" href="{:U('Wap/editCat','id='.$vo['id'])}">编辑</a>-->
                        <!--</td>-->
                    </tr>
                </volist>
                </tbody>
            </table>
        </div>

    </div>

</div>
<script>

    function updateCatname(obj, id) {
        $.ajax({
            type:'post',
            url:"{:U('Wap/ajax_updatecat')}",
            data:{
                id:id,
                wap_catname:obj.value
            },
            timeout:10000,
            beforeSend:function(){
                $.scojs_message('正在提交...', $.scojs_message.TYPE_OK);
            },
            success:function(msg) {
                 if(msg.status==1) {
                     $.scojs_message('数据保存成功...', $.scojs_message.TYPE_OK);
                }else {
                    //tipsBox.empty().append("<span class='gtl_ico_succ'></span>"+msg+"。。。  <span class='gtl_end'></span>");
                }
                setTimeout(function(){
                    location.href = "{:U('Wap/cat')}";
                }, 700);
            }
        });
    }
    function updateStatus(value, id) {
        $.ajax({
            type:'post',
            url:"{:U('Wap/ajax_updatecat')}",
            data:{
                id:id,
                is_wap_menu:value
            },
            timeout:10000,
            beforeSend:function(){
                $.scojs_message('正在提交...', $.scojs_message.TYPE_OK);
            },
            success:function(msg) {
                 if(msg.status==1) {
                     $.scojs_message('数据保存成功...', $.scojs_message.TYPE_OK);
                     setTimeout(function(){
                         location.href = "{:U('Wap/cat')}";
                     }, 700);
                }else {
                     $.scojs_message(msg.info, $.scojs_message.TYPE_ERROR);
                }
            }
        });
    }
</script>
</block>